This document provides information about ODF's SOM files.
Table of Contents
-------------------------
• Summary
• Updating Existing Code
• Compiling Other IDL Files
Summary
In all of our examples, we have renamed SOMPart.cpp to SOMPtMc.cpp (it stands for SOM Part Macro). SOMIter.cpp has also been renamed to SOMItMc.cpp. This was done to fix problems with our build system which interfered with developing extensions. We suggest that you make this change to your parts as well.
Normally, the SOM compiler will generate a source file (.cpp extension) from an IDL file (.idl extension), or if one exists it will be updated. ODF uses large macros in the implementation of the SOM .cpp files, which the SOM compiler can't handle well. Therefore we had commented out the build rules for updating the .cpp file. This prevented developers from writing extensions (which require .idl and .cpp files) without changing our build system.
Because we haven't found any way to prevent the SOM compiler from trying to update our .cpp files, we renamed them so they don't match the .idl files. If you use MPW for development then you should do this as well, since under the newly uncommented rules the SOM compiler will try to update your SOMPart.cpp (or SOMIter.cpp) files. Note that if you are writing extensions then you don't have to rename their .cpp files.
Updating Existing Code
• If you are updating a pre-ODF2 part:
Rename your SOMPart.cpp file to SOMPartMacro.cpp. If your part does embedding, rename SOMIter.cpp to SOMIterMacro.cpp. You will need to change your MacMake.bmk file, as well, from this:
__ComponentObjects = ∂
"{_FWObjDir}SOMPart.cpp.o" ∂
…
to this:
__ComponentObjects = ∂
"{_FWObjDir}SOMPartMacro.cpp.o" ∂
…
Also remove the dependency from .cpp to .idl. It probably looks like this:
"{_FWTargetDir}SOMPtMc.cpp" ƒ ∂
"{_FWTargetDir}SOMPart.idl" ∂
"{_FWTargetDir}SOMPart.xh" ∂
"{_FWTargetDir}SOMPart.xih"
However it should actually read like this:
"{_FWTargetObjectsDir}SOMPtMc.cpp.o" ƒ ∂
"{_FWTargetDir}SOMPart.xh" ∂
"{_FWTargetDir}SOMPart.xih"
Compiling Other IDL Files
If you are writing an extension or otherwise adding a .idl file to your project, add two dependencies to your makefile, like this:
"{_FWTargetDir}MyExtension.cpp" ƒ ∂
"{_FWTargetDir}MyExtension.idl"
"{_FWTargetObjectsDir}MyExtension.cpp.o" ƒ ∂
"{_FWTargetDir}MyExtension.xh" ∂
"{_FWTargetDir}MyExtension.xih"
CodeWarrior developers using the SOMobjectsTS plugin should also add the .idl file to the project window.